package memory.GUI;

import java.awt.Color;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.swing.*;

/**
 *
 * @author Scott Robinson
 */
public class ControlPanel extends JPanel {
    
    private final JTextField timerDisplay;
    private final Calendar cal;
    private final SimpleDateFormat formatter = new SimpleDateFormat("mm:ss");
    
    public ControlPanel () {
        cal = Calendar.getInstance();
        cal.setTimeInMillis(0);
        String formattedDate = formatter.format(cal.getTime());
        
        //timerDisplay = new JTextField(DateFormat.getTimeInstance().format(d.getTime()));        
        timerDisplay = new JTextField(formattedDate);
        timerDisplay.setFont(new Font("Serif", Font.BOLD, 30));
        timerDisplay.setEditable(false);
        timerDisplay.setBackground(Color.WHITE);
        this.add(timerDisplay);
    }
    
    public void updateTime() {
        timerDisplay.setText(formatter.format(cal.getTime()));        
    }

    public String timerToString() {
        return timerDisplay.getText();
    }

    public Calendar getCal() {
        return cal;
    }
    public JTextField getTimerDisplay() {
        return timerDisplay;
    }





}
